Class: SixSaferpay::SixTransaction::CaptureResponse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_header:, capture_id: nil, status:, date:, invoice: nil) ⇒ CaptureResponse

Returns a new instance of CaptureResponse.



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

def initialize(response_header: ,
              capture_id: nil,
              status: ,
              date: ,
              invoice: nil)
  @response_header = SixSaferpay::ResponseHeader.new(**response_header.to_h) if response_header
  @capture_id = capture_id
  @status = status
  @date = date
  @invoice = SixSaferpay::Invoice.new(**invoice.to_h) if invoice
end

Instance Attribute Details

#capture_idObject

Returns the value of attribute capture_id.



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

def capture_id
  @capture_id
end

#dateObject

Returns the value of attribute date.



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

def date
  @date
end

#invoiceObject

Returns the value of attribute invoice.



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

def invoice
  @invoice
end

#response_headerObject

Returns the value of attribute response_header.



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

def response_header
  @response_header
end

#statusObject

Returns the value of attribute status.



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

def status
  @status
end

Instance Method Details

#to_hashObject Also known as: to_h



24
25
26
27
28
29
30
31
32
# File 'lib/six_saferpay/api/six_transaction/responses/capture_response.rb', line 24

def to_hash
  hash = Hash.new
  hash.merge!(response_header: @response_header.to_h) if @response_header
  hash.merge!(capture_id: @capture_id) if @capture_id
  hash.merge!(status: @status) if @status
  hash.merge!(date: @date) if @date
  hash.merge!(invoice: @invoice.to_h) if @invoice
  hash
end