Class: SixSaferpay::SixTransaction::CancelResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/six_saferpay/api/six_transaction/responses/cancel_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_header:, transaction_id:, order_id: nil, date: nil) ⇒ CancelResponse

Returns a new instance of CancelResponse.



11
12
13
14
15
16
17
18
19
20
# File 'lib/six_saferpay/api/six_transaction/responses/cancel_response.rb', line 11

def initialize(response_header:,
               transaction_id:,
               order_id: nil,
               date: nil
              )
  @response_header = SixSaferpay::ResponseHeader.new(**response_header.to_h) if response_header
  @transaction_id = transaction_id
  @order_id = order_id
  @date = date
end

Instance Attribute Details

#dateObject

Returns the value of attribute date.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/responses/cancel_response.rb', line 5

def date
  @date
end

#order_idObject

Returns the value of attribute order_id.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/responses/cancel_response.rb', line 5

def order_id
  @order_id
end

#response_headerObject

Returns the value of attribute response_header.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/responses/cancel_response.rb', line 5

def response_header
  @response_header
end

#transaction_idObject

Returns the value of attribute transaction_id.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/responses/cancel_response.rb', line 5

def transaction_id
  @transaction_id
end

Instance Method Details

#to_hashObject Also known as: to_h



22
23
24
25
26
27
28
29
# File 'lib/six_saferpay/api/six_transaction/responses/cancel_response.rb', line 22

def to_hash
  hash = Hash.new
  hash.merge!(response_header: @response_header.to_h) if @response_header
  hash.merge!(transaction_id: @transaction_id) if @transaction_id
  hash.merge!(order_id: @order_id) if @order_id
  hash.merge!(date: @date) if @date
  hash
end